package com.benshou.bcss.common.j17common;

import com.benshou.bcss.common.j17common.annotation.Nullable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * @author <a href="mailto:wh1zper@qq.com">wh1zper</a>
 * @see Map.Entry
 */
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class FoolEntry<K, V> implements Map.Entry<K, V> {

    /**
     * 键
     */
    private K key;

    /**
     * 值
     */
    private V value;

    @Nullable
    public K getKey() {
        return this.key;
    }

    @Nullable
    public V getValue() {
        return this.value;
    }

    @Override
    public V setValue(V value) {
        var old = this.value;
        this.value = value;
        return old;
    }
}
